package com.decent.sms.dao;

import com.decent.common.entity.sms.SmsBlacklist;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 短信黑名单sql管理
 *
 * @author wangyx
 */
@Mapper
public interface SmsBlacklistDao {
    /**
     * 添加黑名单
     *
     * @param blackList 黑名单ip
     */
    @Insert("INSERT INTO sms_black_list (ip) VALUES(#{blackList})")
    void addBlackList(@Param("blackList") String blackList);

    /**
     * 查询黑名单
     *
     * @param ip 黑名单ip
     * @return 黑名单信息
     */
    @Select("SELECT ip, create_time FROM sms_black_list WHERE ip = #{ip}")
    SmsBlacklist queryBlackList(@Param("ip") String ip);
}
